
const searchFormList = [
	{ label: '关键词', placeholder:"关键词昵称/ID", value: 'query', type: 'input', width: '200px' },
  { label: '隶属班级', value: 'starid', RawValue: 'star', type: 'inputSearch', width: '180px', option:"sysStar", store: "dictSrv/sysStar"},
  { label: '注册时间', value: 'stime', type: 'date', width: '280px' , dateType: 'daterange'},
	{ label: '', width: '200px', value: 'btnSearch', type: 'slot' }
];

const tables = [ // 表格数据
  { label: '记录ID', value: 'id', sort:'custom'},
  { label: '会员昵称', value: 'nickname'},
  { label: '等级', value: 'level', type: 'slot', width:90},
  { label: '性别', value: 'gender', type: 'slot', width:60},
  { label: '是否管理', value: 'role', type: 'slot'},
  { label: '隶属班级', value: 'starid', type: 'slot'},
  { label: '绑定手机', value: 'phone', width:100},
  { label: '个性签名', value: 'motto', width:120},
  { label: '生日', value: 'birthday', width:100},
  { label: '状态', value: 'status', type: 'slot'},
  { label: '注册时间', value: 'regtime'},
  { label: '注册IP', value: 'regip'},
  { label: '最近登录', value: 'lsttime'},
  { label: '登录IP', value: 'lstip'}
];

const fieldList = [ // 新增弹出数据
  { label: '昵称', value: 'nickname', type: 'input', width: '260px', className:'block'},
  { label: '性别', value: 'gender', type:'select', width: '200px', option: 'sysUserSex', filterable: true, className:''},
  { label: '出生日期', value: 'birthday', type:'date', width: '260px', labelWidth:"120px", className:''},
  { label: '状态', value: 'status', type:'select', width: '200px', labelWidth:"80px", option: 'sysUserStatus', filterable: true, className:''},
  { label: '锁定日期', value: 'expire', type:'date', width: '280px', dateType:"datetime", format:"yyyy-MM-dd HH:mm:ss", labelWidth:"100px", className:''},
];

const rules = {
	nickname: [{ required: true, message: '昵称不允许为空', trigger: 'change' }],
  gender: [{ required: true, message: '请设置性别', trigger: 'change' }],
	status: [{ required: true, message: '请设置状态', trigger: 'change' }],
  birthday: [{ required: true, message: '请设置出生日期', trigger: 'change' }]
};

const fieldData = (data)=>{
  var dataset = {};
  for (var idx = 0; idx < fieldList.length; idx++) {
    var ckey  = fieldList[idx].value;
    dataset[ckey] = (data)? data[ckey]:'';
  }
  dataset.id = (data && data.id)? data.id:0;
  return dataset;
}

export default {
  searchFormList,tables,fieldList,fieldData,rules
};